export default function waitSecond({
	second,
	diff = 1,
	onPro = () => {},
	onEnd = () => {}
}) {
	let timer = null
	function step() {
		onPro(second)
		second -= diff
		if (second > 0) {
			timer = setTimeout(step, Math.min(diff, second) * 1000)
		} else {
			clearTimeout(timer)
			onPro(0)
			onEnd()
		}
	}
	step()
}
